package com.entity;

import java.io.Serializable;
import javax.persistence.*;

import com.alibaba.fastjson.annotation.JSONField;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the CONTRACT database table.
 * 
 */
@Entity
@NamedQuery(name="Contract.findAll", query="SELECT c FROM Contract c")
public class Contract implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="CONTRACT_COID_GENERATOR", sequenceName="SEQ",initialValue=1,allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="CONTRACT_COID_GENERATOR")
	@Column(name="CO_ID")
	private long coId;

	@Column(name="CO_ADDRESS")
	private String coAddress;

	@Temporal(TemporalType.DATE)
	@Column(name="CO_FINISHTIME")
	private Date coFinishtime;

	@Column(name="CO_FOREIGN")
	private String coForeign;

	@Column(name="CO_NUMBER")
	private String coNumber;

	@Temporal(TemporalType.DATE)
	@Column(name="CO_SIGN")
	private Date coSign;

	@Temporal(TemporalType.DATE)
	@Column(name="CO_STARTTIME")
	private Date coStarttime;

	@Column(name="CO_STATE")
	private BigDecimal coState;

	@Column(name="CO_TITLE")
	private String coTitle;

	@Column(name="OR_MONEY")
	private BigDecimal orMoney;

	//bi-directional many-to-one association to Payplan
	@OneToMany(mappedBy="contract")
	@JSONField(serialize=false)
	private List<Payplan> payplans;

	public Contract() {
	}

	public long getCoId() {
		return this.coId;
	}

	public void setCoId(long coId) {
		this.coId = coId;
	}

	public String getCoAddress() {
		return this.coAddress;
	}

	public void setCoAddress(String coAddress) {
		this.coAddress = coAddress;
	}

	public Date getCoFinishtime() {
		return this.coFinishtime;
	}

	public void setCoFinishtime(Date coFinishtime) {
		this.coFinishtime = coFinishtime;
	}

	public String getCoForeign() {
		return this.coForeign;
	}

	public void setCoForeign(String coForeign) {
		this.coForeign = coForeign;
	}

	public String getCoNumber() {
		return this.coNumber;
	}

	public void setCoNumber(String coNumber) {
		this.coNumber = coNumber;
	}

	public Date getCoSign() {
		return this.coSign;
	}

	public void setCoSign(Date coSign) {
		this.coSign = coSign;
	}

	public Date getCoStarttime() {
		return this.coStarttime;
	}

	public void setCoStarttime(Date coStarttime) {
		this.coStarttime = coStarttime;
	}

	public BigDecimal getCoState() {
		return this.coState;
	}

	public void setCoState(BigDecimal coState) {
		this.coState = coState;
	}

	public String getCoTitle() {
		return this.coTitle;
	}

	public void setCoTitle(String coTitle) {
		this.coTitle = coTitle;
	}

	public BigDecimal getOrMoney() {
		return this.orMoney;
	}

	public void setOrMoney(BigDecimal orMoney) {
		this.orMoney = orMoney;
	}

	public List<Payplan> getPayplans() {
		return this.payplans;
	}

	public void setPayplans(List<Payplan> payplans) {
		this.payplans = payplans;
	}

	public Payplan addPayplan(Payplan payplan) {
		getPayplans().add(payplan);
		payplan.setContract(this);

		return payplan;
	}

	public Payplan removePayplan(Payplan payplan) {
		getPayplans().remove(payplan);
		payplan.setContract(null);

		return payplan;
	}

}